{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "628d2e91",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "db6380b2",
   "metadata": {},
   "source": [
    "1.读取数据"
   ]
  },
  {
   "cell_type": "raw",
   "id": "a41dbd8a",
   "metadata": {},
   "source": [
    "文件路径：filepath_or_buffer\n",
    "    相对路径、绝对路径\n",
    "字符集编码：encoding\n",
    "    gbk、utf-8等等\n",
    "字段分割符：sep\n",
    "    模型默认为逗号，可以按文件内容看用什么做分割符号\n",
    "只读取某些列：usecols\n",
    "    可以先读取所有的列、然后再挑选出想要的列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "51517a53",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>客户编号</th>\n",
       "      <th>是否4G资费</th>\n",
       "      <th>网龄</th>\n",
       "      <th>视频流量</th>\n",
       "      <th>微信社交流量</th>\n",
       "      <th>网页浏览流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10942</td>\n",
       "      <td>1</td>\n",
       "      <td>204</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>1528</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>13382</td>\n",
       "      <td>0</td>\n",
       "      <td>201</td>\n",
       "      <td>15</td>\n",
       "      <td>24</td>\n",
       "      <td>1120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4192</td>\n",
       "      <td>1</td>\n",
       "      <td>167</td>\n",
       "      <td>1</td>\n",
       "      <td>2708</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10908</td>\n",
       "      <td>0</td>\n",
       "      <td>171</td>\n",
       "      <td>4</td>\n",
       "      <td>260</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>14130</td>\n",
       "      <td>1</td>\n",
       "      <td>216</td>\n",
       "      <td>35</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    客户编号  是否4G资费   网龄  视频流量  微信社交流量  网页浏览流量\n",
       "0  10942       1  204    22      42    1528\n",
       "1  13382       0  201    15      24    1120\n",
       "2   4192       1  167     1    2708       0\n",
       "3  10908       0  171     4     260      15\n",
       "4  14130       1  216    35      28       0"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('./data/data.csv',sep=',',encoding='GBK',usecols=['客户编号','是否4G资费','网龄','视频流量','微信社交流量','网页浏览流量'])\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cc1146b9",
   "metadata": {},
   "source": [
    "2.观察数据"
   ]
  },
  {
   "cell_type": "raw",
   "id": "1d0ad358",
   "metadata": {},
   "source": [
    "查看数据前五行(查看除表头外的前5行)、后5行\n",
    "查看数据行列数\n",
    "查看缺失值\n",
    "查看数据类型\n",
    "查看数据基本情况(describe)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "052db039",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>客户编号</th>\n",
       "      <th>是否4G资费</th>\n",
       "      <th>网龄</th>\n",
       "      <th>视频流量</th>\n",
       "      <th>微信社交流量</th>\n",
       "      <th>网页浏览流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>19995</th>\n",
       "      <td>18102</td>\n",
       "      <td>0</td>\n",
       "      <td>165</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19996</th>\n",
       "      <td>18216</td>\n",
       "      <td>0</td>\n",
       "      <td>200</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19997</th>\n",
       "      <td>18347</td>\n",
       "      <td>0</td>\n",
       "      <td>179</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19998</th>\n",
       "      <td>18457</td>\n",
       "      <td>0</td>\n",
       "      <td>72</td>\n",
       "      <td>104</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19999</th>\n",
       "      <td>18664</td>\n",
       "      <td>0</td>\n",
       "      <td>162</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        客户编号  是否4G资费   网龄  视频流量  微信社交流量  网页浏览流量\n",
       "19995  18102       0  165     6       0       2\n",
       "19996  18216       0  200     1       0       0\n",
       "19997  18347       0  179    14       0       0\n",
       "19998  18457       0   72   104       0       0\n",
       "19999  18664       0  162    17       0       0"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head() #前5行\n",
    "df.tail()  #后5行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "ff2530b2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(20000, 6)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "f4ad7cbb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "客户编号      False\n",
       "是否4G资费    False\n",
       "网龄        False\n",
       "视频流量      False\n",
       "微信社交流量    False\n",
       "网页浏览流量    False\n",
       "dtype: bool"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.isnull().sum()  #查看缺失值数量\n",
    "df.isnull().any()  #查看是否有缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "bdc19023",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 20000 entries, 0 to 19999\n",
      "Data columns (total 6 columns):\n",
      " #   Column  Non-Null Count  Dtype\n",
      "---  ------  --------------  -----\n",
      " 0   客户编号    20000 non-null  int64\n",
      " 1   是否4G资费  20000 non-null  int64\n",
      " 2   网龄      20000 non-null  int64\n",
      " 3   视频流量    20000 non-null  int64\n",
      " 4   微信社交流量  20000 non-null  int64\n",
      " 5   网页浏览流量  20000 non-null  int64\n",
      "dtypes: int64(6)\n",
      "memory usage: 937.6 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()  #查看数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "79a1acf1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>客户编号</th>\n",
       "      <th>是否4G资费</th>\n",
       "      <th>网龄</th>\n",
       "      <th>视频流量</th>\n",
       "      <th>微信社交流量</th>\n",
       "      <th>网页浏览流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>20000.000000</td>\n",
       "      <td>20000.000000</td>\n",
       "      <td>20000.000000</td>\n",
       "      <td>20000.00000</td>\n",
       "      <td>20000.000000</td>\n",
       "      <td>20000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>10000.500000</td>\n",
       "      <td>0.447150</td>\n",
       "      <td>182.408000</td>\n",
       "      <td>14.64985</td>\n",
       "      <td>43.810400</td>\n",
       "      <td>52.919900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>5773.647028</td>\n",
       "      <td>0.497211</td>\n",
       "      <td>21.901765</td>\n",
       "      <td>13.16348</td>\n",
       "      <td>160.258905</td>\n",
       "      <td>220.800798</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>41.000000</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>5000.750000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>166.000000</td>\n",
       "      <td>5.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>10000.500000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>183.000000</td>\n",
       "      <td>11.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>15000.250000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>197.000000</td>\n",
       "      <td>21.00000</td>\n",
       "      <td>24.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>20000.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>260.000000</td>\n",
       "      <td>116.00000</td>\n",
       "      <td>5139.000000</td>\n",
       "      <td>5705.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               客户编号        是否4G资费            网龄         视频流量        微信社交流量  \\\n",
       "count  20000.000000  20000.000000  20000.000000  20000.00000  20000.000000   \n",
       "mean   10000.500000      0.447150    182.408000     14.64985     43.810400   \n",
       "std     5773.647028      0.497211     21.901765     13.16348    160.258905   \n",
       "min        1.000000      0.000000     41.000000      0.00000      0.000000   \n",
       "25%     5000.750000      0.000000    166.000000      5.00000      0.000000   \n",
       "50%    10000.500000      0.000000    183.000000     11.00000      0.000000   \n",
       "75%    15000.250000      1.000000    197.000000     21.00000     24.000000   \n",
       "max    20000.000000      1.000000    260.000000    116.00000   5139.000000   \n",
       "\n",
       "             网页浏览流量  \n",
       "count  20000.000000  \n",
       "mean      52.919900  \n",
       "std      220.800798  \n",
       "min        0.000000  \n",
       "25%        0.000000  \n",
       "50%        0.000000  \n",
       "75%        0.000000  \n",
       "max     5705.000000  "
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()  # 查看数据情况  一般用来做特征缩放   默认只会看object类型的数据\n",
    "# df.describe(include='O')  #这个只看object类型的数据，这里没有object类型的数据，会报错"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bddf560c",
   "metadata": {},
   "source": [
    "3.数据操作"
   ]
  },
  {
   "cell_type": "raw",
   "id": "994c5796",
   "metadata": {},
   "source": [
    "删除：\n",
    "    1.按行删除\n",
    "    2.按列删除\n",
    "    3.删除缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "b34d52ec",
   "metadata": {},
   "outputs": [],
   "source": [
    "#axis:0表示按行删，1表示按列删  index:按行删除时行的索引  columns：表示按列删除时的列名  inplace:是否改变原本数据，默认是false\n",
    "df1 = df.drop(axis=1,columns=['客户编号']) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ae320e07",
   "metadata": {},
   "outputs": [],
   "source": [
    "# del df['列名']  #这个也可以按列删，但是是删了原本的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "a6ec4795",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>是否4G资费</th>\n",
       "      <th>网龄</th>\n",
       "      <th>视频流量</th>\n",
       "      <th>微信社交流量</th>\n",
       "      <th>网页浏览流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>204</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>1528</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>201</td>\n",
       "      <td>15</td>\n",
       "      <td>24</td>\n",
       "      <td>1120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>167</td>\n",
       "      <td>1</td>\n",
       "      <td>2708</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>171</td>\n",
       "      <td>4</td>\n",
       "      <td>260</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>216</td>\n",
       "      <td>35</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19995</th>\n",
       "      <td>0</td>\n",
       "      <td>165</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19996</th>\n",
       "      <td>0</td>\n",
       "      <td>200</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19997</th>\n",
       "      <td>0</td>\n",
       "      <td>179</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19998</th>\n",
       "      <td>0</td>\n",
       "      <td>72</td>\n",
       "      <td>104</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19999</th>\n",
       "      <td>0</td>\n",
       "      <td>162</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20000 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       是否4G资费   网龄  视频流量  微信社交流量  网页浏览流量\n",
       "0           1  204    22      42    1528\n",
       "1           0  201    15      24    1120\n",
       "2           1  167     1    2708       0\n",
       "3           0  171     4     260      15\n",
       "4           1  216    35      28       0\n",
       "...       ...  ...   ...     ...     ...\n",
       "19995       0  165     6       0       2\n",
       "19996       0  200     1       0       0\n",
       "19997       0  179    14       0       0\n",
       "19998       0   72   104       0       0\n",
       "19999       0  162    17       0       0\n",
       "\n",
       "[20000 rows x 5 columns]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "638b5178",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>是否4G资费</th>\n",
       "      <th>网龄</th>\n",
       "      <th>视频流量</th>\n",
       "      <th>微信社交流量</th>\n",
       "      <th>网页浏览流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>201</td>\n",
       "      <td>15</td>\n",
       "      <td>24</td>\n",
       "      <td>1120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>167</td>\n",
       "      <td>1</td>\n",
       "      <td>2708</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>171</td>\n",
       "      <td>4</td>\n",
       "      <td>260</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>216</td>\n",
       "      <td>35</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1</td>\n",
       "      <td>224</td>\n",
       "      <td>1</td>\n",
       "      <td>432</td>\n",
       "      <td>244</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   是否4G资费   网龄  视频流量  微信社交流量  网页浏览流量\n",
       "1       0  201    15      24    1120\n",
       "2       1  167     1    2708       0\n",
       "3       0  171     4     260      15\n",
       "4       1  216    35      28       0\n",
       "5       1  224     1     432     244"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2 = df1.drop(axis=0,index=[0])   #删了后没了0号索引\n",
    "df2.head()"
   ]
  },
  {
   "cell_type": "raw",
   "id": "a3815291",
   "metadata": {},
   "source": [
    "查询：\n",
    "    按列查询、按行查询、按条件查询\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "8dbed223",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0        10942\n",
       "1        13382\n",
       "2         4192\n",
       "3        10908\n",
       "4        14130\n",
       "         ...  \n",
       "19995    18102\n",
       "19996    18216\n",
       "19997    18347\n",
       "19998    18457\n",
       "19999    18664\n",
       "Name: 客户编号, Length: 20000, dtype: int64"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['客户编号']  #按列查询"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "31cff7f4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "客户编号      14130\n",
       "是否4G资费        1\n",
       "网龄          216\n",
       "视频流量         35\n",
       "微信社交流量       28\n",
       "网页浏览流量        0\n",
       "Name: 4, dtype: int64"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[0:2]   #按行查询\n",
    "df['客户编号'][0]   #按行列查询\n",
    "df.iloc[4]   #查看第四行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "2600537c",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>客户编号</th>\n",
       "      <th>是否4G资费</th>\n",
       "      <th>网龄</th>\n",
       "      <th>视频流量</th>\n",
       "      <th>微信社交流量</th>\n",
       "      <th>网页浏览流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10942</td>\n",
       "      <td>1</td>\n",
       "      <td>204</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>1528</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>1093</td>\n",
       "      <td>1</td>\n",
       "      <td>205</td>\n",
       "      <td>7</td>\n",
       "      <td>500</td>\n",
       "      <td>5705</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122</th>\n",
       "      <td>4027</td>\n",
       "      <td>1</td>\n",
       "      <td>203</td>\n",
       "      <td>15</td>\n",
       "      <td>48</td>\n",
       "      <td>1248</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>385</th>\n",
       "      <td>876</td>\n",
       "      <td>1</td>\n",
       "      <td>246</td>\n",
       "      <td>1</td>\n",
       "      <td>37</td>\n",
       "      <td>1928</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>708</th>\n",
       "      <td>12611</td>\n",
       "      <td>1</td>\n",
       "      <td>201</td>\n",
       "      <td>12</td>\n",
       "      <td>18</td>\n",
       "      <td>2914</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>755</th>\n",
       "      <td>783</td>\n",
       "      <td>1</td>\n",
       "      <td>211</td>\n",
       "      <td>4</td>\n",
       "      <td>531</td>\n",
       "      <td>1651</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1002</th>\n",
       "      <td>1008</td>\n",
       "      <td>1</td>\n",
       "      <td>201</td>\n",
       "      <td>2</td>\n",
       "      <td>25</td>\n",
       "      <td>2003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1039</th>\n",
       "      <td>12578</td>\n",
       "      <td>1</td>\n",
       "      <td>260</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>1690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1133</th>\n",
       "      <td>399</td>\n",
       "      <td>1</td>\n",
       "      <td>205</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>1214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1213</th>\n",
       "      <td>10944</td>\n",
       "      <td>1</td>\n",
       "      <td>203</td>\n",
       "      <td>21</td>\n",
       "      <td>40</td>\n",
       "      <td>1996</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1340</th>\n",
       "      <td>10960</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>1921</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1415</th>\n",
       "      <td>115</td>\n",
       "      <td>1</td>\n",
       "      <td>213</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1235</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1504</th>\n",
       "      <td>1384</td>\n",
       "      <td>1</td>\n",
       "      <td>205</td>\n",
       "      <td>20</td>\n",
       "      <td>0</td>\n",
       "      <td>2338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1757</th>\n",
       "      <td>11095</td>\n",
       "      <td>1</td>\n",
       "      <td>202</td>\n",
       "      <td>8</td>\n",
       "      <td>4</td>\n",
       "      <td>1065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1801</th>\n",
       "      <td>10845</td>\n",
       "      <td>1</td>\n",
       "      <td>202</td>\n",
       "      <td>4</td>\n",
       "      <td>495</td>\n",
       "      <td>1070</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1849</th>\n",
       "      <td>873</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>1981</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2502</th>\n",
       "      <td>615</td>\n",
       "      <td>1</td>\n",
       "      <td>207</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1829</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2563</th>\n",
       "      <td>620</td>\n",
       "      <td>1</td>\n",
       "      <td>201</td>\n",
       "      <td>5</td>\n",
       "      <td>33</td>\n",
       "      <td>1845</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2720</th>\n",
       "      <td>190</td>\n",
       "      <td>1</td>\n",
       "      <td>210</td>\n",
       "      <td>6</td>\n",
       "      <td>26</td>\n",
       "      <td>1794</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2879</th>\n",
       "      <td>936</td>\n",
       "      <td>1</td>\n",
       "      <td>201</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>1618</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3912</th>\n",
       "      <td>14190</td>\n",
       "      <td>1</td>\n",
       "      <td>208</td>\n",
       "      <td>6</td>\n",
       "      <td>9</td>\n",
       "      <td>1532</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4308</th>\n",
       "      <td>161</td>\n",
       "      <td>1</td>\n",
       "      <td>224</td>\n",
       "      <td>13</td>\n",
       "      <td>7</td>\n",
       "      <td>1364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4987</th>\n",
       "      <td>226</td>\n",
       "      <td>1</td>\n",
       "      <td>205</td>\n",
       "      <td>6</td>\n",
       "      <td>36</td>\n",
       "      <td>1327</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5532</th>\n",
       "      <td>899</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>23</td>\n",
       "      <td>0</td>\n",
       "      <td>1558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10095</th>\n",
       "      <td>693</td>\n",
       "      <td>1</td>\n",
       "      <td>212</td>\n",
       "      <td>2</td>\n",
       "      <td>58</td>\n",
       "      <td>1073</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        客户编号  是否4G资费   网龄  视频流量  微信社交流量  网页浏览流量\n",
       "0      10942       1  204    22      42    1528\n",
       "78      1093       1  205     7     500    5705\n",
       "122     4027       1  203    15      48    1248\n",
       "385      876       1  246     1      37    1928\n",
       "708    12611       1  201    12      18    2914\n",
       "755      783       1  211     4     531    1651\n",
       "1002    1008       1  201     2      25    2003\n",
       "1039   12578       1  260    27       0    1690\n",
       "1133     399       1  205     8       0    1214\n",
       "1213   10944       1  203    21      40    1996\n",
       "1340   10960       1  200     9       0    1921\n",
       "1415     115       1  213     2       0    1235\n",
       "1504    1384       1  205    20       0    2338\n",
       "1757   11095       1  202     8       4    1065\n",
       "1801   10845       1  202     4     495    1070\n",
       "1849     873       1  200     5      10    1981\n",
       "2502     615       1  207     3       0    1829\n",
       "2563     620       1  201     5      33    1845\n",
       "2720     190       1  210     6      26    1794\n",
       "2879     936       1  201     6       0    1618\n",
       "3912   14190       1  208     6       9    1532\n",
       "4308     161       1  224    13       7    1364\n",
       "4987     226       1  205     6      36    1327\n",
       "5532     899       1  200    23       0    1558\n",
       "10095    693       1  212     2      58    1073"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#按条件查询\n",
    "df[(df['网龄']>=200) & (df['是否4G资费']==1) &(df['网页浏览流量']>=1000) ]   #网龄大于200\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85ec260e",
   "metadata": {},
   "source": [
    "4.数据合并"
   ]
  },
  {
   "cell_type": "raw",
   "id": "3e32abd0",
   "metadata": {},
   "source": [
    "合并：\n",
    "    按行合并、按列合并\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "68f36d06",
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = pd.DataFrame(columns=['id','name','age'])   #初始化一个dataframe\n",
    "df2 = pd.DataFrame(columns=['id','class','teacher'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "a4e64545",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [id, name, age]\n",
       "Index: []"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "79c2028c",
   "metadata": {},
   "outputs": [],
   "source": [
    "df1['id'] = [1,2,3,4]\n",
    "df1['name'] = ['zs','ls','ww','zl']\n",
    "df1['age'] = [15,17,18,16]\n",
    "df2['id'] = [1,2,3,5]\n",
    "df2['class'] = ['c1','c2','c3','c4']\n",
    "df2['teacher'] = ['t1','t2','t3','t4']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "28564169",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>zs</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>ls</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>ww</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>zl</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id name  age\n",
       "0   1   zs   15\n",
       "1   2   ls   17\n",
       "2   3   ww   18\n",
       "3   4   zl   16"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "ceb4a40e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>class</th>\n",
       "      <th>teacher</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>c1</td>\n",
       "      <td>t1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>c2</td>\n",
       "      <td>t2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>c3</td>\n",
       "      <td>t3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5</td>\n",
       "      <td>c4</td>\n",
       "      <td>t4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id class teacher\n",
       "0   1    c1      t1\n",
       "1   2    c2      t2\n",
       "2   3    c3      t3\n",
       "3   5    c4      t4"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "17eb0f00",
   "metadata": {},
   "outputs": [],
   "source": [
    "#合并，axis=1表示按列合并，axis=0表示按行合并\n",
    "df3 = pd.concat((df1,df2),axis=1)  #这里等于新增了几列，不做任何改变"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "8c933743",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>id</th>\n",
       "      <th>class</th>\n",
       "      <th>teacher</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>zs</td>\n",
       "      <td>15</td>\n",
       "      <td>1</td>\n",
       "      <td>c1</td>\n",
       "      <td>t1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>ls</td>\n",
       "      <td>17</td>\n",
       "      <td>2</td>\n",
       "      <td>c2</td>\n",
       "      <td>t2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>ww</td>\n",
       "      <td>18</td>\n",
       "      <td>3</td>\n",
       "      <td>c3</td>\n",
       "      <td>t3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>zl</td>\n",
       "      <td>16</td>\n",
       "      <td>5</td>\n",
       "      <td>c4</td>\n",
       "      <td>t4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id name  age  id class teacher\n",
       "0   1   zs   15   1    c1      t1\n",
       "1   2   ls   17   2    c2      t2\n",
       "2   3   ww   18   3    c3      t3\n",
       "3   4   zl   16   5    c4      t4"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "5176101c",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>class</th>\n",
       "      <th>teacher</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>zs</td>\n",
       "      <td>15.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>ls</td>\n",
       "      <td>17.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>ww</td>\n",
       "      <td>18.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>zl</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>c1</td>\n",
       "      <td>t1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>c2</td>\n",
       "      <td>t2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>c3</td>\n",
       "      <td>t3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>c4</td>\n",
       "      <td>t4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id name   age class teacher\n",
       "0   1   zs  15.0   NaN     NaN\n",
       "1   2   ls  17.0   NaN     NaN\n",
       "2   3   ww  18.0   NaN     NaN\n",
       "3   4   zl  16.0   NaN     NaN\n",
       "0   1  NaN   NaN    c1      t1\n",
       "1   2  NaN   NaN    c2      t2\n",
       "2   3  NaN   NaN    c3      t3\n",
       "3   5  NaN   NaN    c4      t4"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3 = pd.concat((df1,df2),axis=0) #按行合并\n",
    "df3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "bbf1f1d3",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 按照某个字段合并\n",
    "df4 = pd.merge(left=df1,right=df2,on='id') #求并集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "6362b271",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>class</th>\n",
       "      <th>teacher</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>zs</td>\n",
       "      <td>15</td>\n",
       "      <td>c1</td>\n",
       "      <td>t1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>ls</td>\n",
       "      <td>17</td>\n",
       "      <td>c2</td>\n",
       "      <td>t2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>ww</td>\n",
       "      <td>18</td>\n",
       "      <td>c3</td>\n",
       "      <td>t3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id name  age class teacher\n",
       "0   1   zs   15    c1      t1\n",
       "1   2   ls   17    c2      t2\n",
       "2   3   ww   18    c3      t3"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b894565e",
   "metadata": {},
   "source": [
    "5.数据插入操作"
   ]
  },
  {
   "cell_type": "raw",
   "id": "d3a67e5d",
   "metadata": {},
   "source": [
    "插入行\n",
    "插入列\n",
    "定义一个DataFrame然后按行按列插入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "5bbd238d",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\lenovo\\AppData\\Local\\Temp\\ipykernel_21936\\1193901182.py:5: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
      "  df5.append({'id':5,'name':'sq','age':16},ignore_index=True) #按行插入数据，有返回值，不可对原本进行改变\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>zs</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>ls</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>ww</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>zl</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>sq</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id name  age\n",
       "0   1   zs   15\n",
       "1   2   ls   17\n",
       "2   3   ww   18\n",
       "3   4   zl   16\n",
       "4   5   sq   16"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df5 = pd.DataFrame(columns=['id','name','age'])\n",
    "df5['id'] = [1,2,3,4]\n",
    "df5['name'] = ['zs','ls','ww','zl']\n",
    "df5['age'] = [15,17,18,16]\n",
    "df5.append({'id':5,'name':'sq','age':16},ignore_index=True) #按行插入数据，有返回值，不可对原本进行改变"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "2a7c5af2",
   "metadata": {},
   "outputs": [],
   "source": [
    "df5['sex'] = ['m','w','w','m'] #按列插入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "7f029cb2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 定义一个DataFrame然后按行按列插入数据\n",
    "df6 = pd.DataFrame(columns=['id','name','age'])\n",
    "for col in df6.columns:\n",
    "    for ind in range(0,4):\n",
    "        df6.loc[ind,col] = ind"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "5edcdcea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  id name age\n",
       "0  0    0   0\n",
       "1  1    1   1\n",
       "2  2    2   2\n",
       "3  3    3   3"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df6"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0a0b1af",
   "metadata": {},
   "source": [
    "6.绘图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "4271e6e8",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: xlabel='age'>"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGrC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xcbsfE21oaFBdXZ3L4mkmTJigefPmKT09XQMGDNDAgQP1f//3f879S5cu1fDhw9W3b1+FhoZq9uzZ+vbbb5378/LyFBAQoDfffFORkZHq06eP7rrrLtXX1+uVV15ReHi4rrjiCs2dO1fNzc3OcY2NjUpPT9fVV1+tvn376oc//KF27NhxEZ85AACu3P7Ssw8++EBxcXE6deqU+vXrpw0bNuiGG25o81i73a7g4GCXbcHBwWpqalJNTc1Zv9EzMzNTixYtcndq3c4rr7wim82m9957T3v27NF9992nH/3oR7rlllvk5eWlZcuWKTw8XEePHtXs2bOVnp6uF1980Tn+u+++07Jly7Ru3TqdOHFCd955p+68804FBARoy5YtOnLkiKZOnaqxY8dq2rRpkqQZM2bos88+07p16xQSEqINGzboJz/5iT744AMNHTrU1K8CAC6Ki3094aXiUr+u0e0zI5GRkSorK9PevXs1a9Ys3XvvvTpw4MBZj//f76hwOBxtbv9vGRkZqq2tdS4VFRXuTrNbGDFihP7whz9o6NChSklJUWxsrN5++21J0sMPP6yJEycqIiJCkyZN0uLFi/XXv/7VZfzp06eVnZ2t0aNHa9y4cbrrrrtUVFSklStX6oYbbtCtt96qiRMnqrCwUJL06aefau3atfrb3/6m+Ph4XXvttUpLS9PYsWOVm5t70Z8/AABSB86M9OrVS0OGDJEkxcbGat++ffrzn/+sl156qdWxAwcOlN1ud9lWXV0tb2/vdr+63cfHRz4+Pu5OrdsZMWKEy7rVanXeB6awsFB//OMfdeDAAdXV1ampqUmnTp1SfX29+vbtK+n7b0a99tprneODg4MVHh6ufv36uWw78zP3798vh8Oh6667zuVxGxoa+Cp9AIAxF3xvGofDoYaGhjb3xcXF6Y033nDZtm3bNsXGxqpnz54X+tDd3v/+DiwWi1paWnTs2DElJSUpNTVVixcv1oABA1RUVKT777/f5Vqbtsaf7WdKUktLi3r06KGSkpJW95j574ABAOBicitGFixYoMTERIWGhurEiRNat26dduzYoa1bt0r6/u2VyspKrV69WpKUmpqqF154QTabTQ8++KD27NmjlStXau3atZ3/TDxI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JKSEhUWFqpfv37O5frrr3f+bACegxvlAegSycnJCg0N1V/+8heFhISopaVFw4YNU2NjoxwOhywWi8vx/3uStqWlRcnJyXrmmWda/WzueAp4FmIEQKf76quvdPDgQb300kuKj4+XJBUVFTn3X3/99Xr11VfV0NAgHx8fSVJxcbHLz7jxxhuVn5+v8PBweXvzTxXgyXibBkCnu+KKKxQYGKgVK1bok08+0fbt22Wz2Zz777nnHrW0tOjXv/61Dh48qLfeektLliyRJOcZkzlz5ujrr7/WL37xC/3rX//SkSNHtG3bNs2cOdPl9uwAuj9iBECn8/Ly0rp161RSUqJhw4Zp/vz5+tOf/uTc7+fnpzfeeENlZWUaNWqUFi5cqMcff1ySnNeRhISE6N1331Vzc7OmTJmiYcOG6Te/+Y38/f3l5cU/XYAn4dM0AC4Jr776qmbMmKHa2lr17t3b9HQAXES8EQvAiNWrV2vw4MG6+uqr9f777+vRRx/V3XffTYgAlyFiBIARdrtdjz/+uOx2u6xWq37+85/rqaeeMj0tAAbwNg0AADCKq8AAAIBRxAgAADCKGAEAAEYRIwAAwChiBAAAGEWMAAAAo4gRAABgFDECAACM+n9qLBlFq4Yq2wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df6.plot(x='age',y='name',kind='bar')   #一般不用df中自带的绘图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2377e0c8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "953f1e06",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a7df19cf",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3ca7e2f7",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5e17162e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
